package com.yifeng.repo.micro.service.server.engine.configure;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration;

/**
 * Created by daibing on 2023/6/20.
 */
public class ForceTransactionBeanFactoryPostProcessor implements BeanFactoryPostProcessor {

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        BeanDefinition definition = beanFactory.getBeanDefinition(ProxyTransactionManagementConfiguration.class.getName());
        definition.setBeanClassName(ForceProxyTransactionManagementConfiguration.class.getName());
    }
}
